package leetcode;
import java.util.HashSet;
import java.util.Set;

/**
 * 【LeetCode题号: 217. 存在重复元素】
 * https://leetcode-cn.com/problems/contains-duplicate/
 */
public class ExistDuplicateElements {
    public boolean containsDuplicate(int[] nums) {
        Set<Integer> set = new HashSet<>();//set去重是个好东西，合理运用
        for (int i = 0; i < nums.length; i++) {
            set.add(nums[i]);
        }
        if (set.size() != nums.length){
            return false;
        }else {
            return true;

        }
    }
}
